<html>
<head>
<title>
  #{{ puzzle.number }} {{ puzzle.title }} ({{ puzzle.key_name }})
  - {{ team.name }} - Iron Puzzler {{ game.location }}
</title>
<link rel="stylesheet" href="static/style.css">
</head><body><div class="pagecontent">

<h2>
  <a href="/">IP {{ game.location }}</a> &raquo;
  <a href="/team?t={{ team.key_id }}">{{ team.name }}</a> &raquo;
  {% if game.voting_enabled %}
    Feedback:
  {% else %}
    {% if solve_time %}
      <span class="guess_correct">Solved</span>:
    {% else %}
      {% if game.solving_enabled %} Solving: {% endif %}
    {% endif %}
  {% endif %}
  #{{ puzzle.number }} {{ puzzle.title }}
</h2>

{% if "spam" in error %}
  <p class="error">Too many guesses submitted too quickly; try again later.</p>
{% endif %}

{% if "dup" in error %}
  <p class="error">That answer was already submitted recently.</p>
{% endif %}

{% if puzzle.puzzle_blob %}
  <h3>Download:
    <b><a href="/download?p={{ puzzle.number|urlencode }}&t={{ team.key_id }}&f=p">
      {{ puzzle.puzzle_blob.filename|default:"file" }}
    </a></b>
  </h3>
{% endif %}

{% if game.solving_enabled and not solve_time %}
  <form action="/guess" method="post">
    <input type="hidden" name="t" value="{{ team.key_id }}">
    <input type="hidden" name="p" value="{{ puzzle.number }}">
    <h3>Solve:
      <input type="text" name="answer" size=20>
      <button type="submit">Submit</button>
    </h3>

    <p>
    {{ solve_teams|length|default:"No" }} team{{ solve_teams|length|pluralize }}
    solved this puzzle so far.</p>
  </form>
{% endif %}

{% if game.voting_enabled or game.results_enabled or solve_time %}
  <form action="/guess" method="post">
    <input type="hidden" name="t" value="{{ team.key_id }}">
    <input type="hidden" name="p" value="{{ puzzle.number }}">

    {% if game.solving_enabled %}
      <h3 style="margin-bottom: 0">Draft Feedback</h3>
      Optional now; you will have time to edit this feedback later.<br>
    {% else %}
      <h3>Feedback</h3>
    {% endif %}

    <p>
      {% for score in feedback.scores %}
        <label>{% cycle "Fun" "Presentation" "Ingredients" %}:
        <input type="text" name="score.{{ forloop.counter0 }}" size="3"
               {% if not game.solving_enabled and not game.voting_enabled %}
                 disabled="disabled"
               {% endif %}
               value="{{ score }}">
        </label>
      {% endfor %}
      Numeric scores, 0.0-5.0.
    </p>

    <textarea name="comment" cols="60" rows="6" class="leftside">
{{ feedback.comment }}</textarea>
    <p class="rightside">Comments for the authors.
    Sent anonymously; sign your name and/or include scores if you wish.</p>

    <button type="submit">Save {% if game.solving_enabled %} draft {% endif %}</button>
  </form>

  <h3>Solution</h3>

  {{ puzzle.solution|linebreaks }}

  {% if puzzle.solution_blob %}
    <p>Download:
      <b><a href="/download?p={{ puzzle.number|urlencode }}&t={{ team.key_id }}&f=s">
        {{ puzzle.solution_blob.filename|default:"file" }}
      </a></b>
     </p>
  {% endif %}
{% endif %}
</form>

{% if puzzle.errata %}
  <h3>Errata <em>({{ puzzle.errata_timestamp|timesince }} ago)</em></h3>
  {{ puzzle.errata|linebreaks }}
{% endif %}

<h3>History</h3>

<table>
  {% for guess in guesses %}
    <tr>
      <td><b>{{ guess.answer }}</b></td>
      <td>
        {% if guess.is_correct %}
          <b class="guess_correct">CORRECT</b>
        {% else %}
          <span class="guess_incorrect">incorrect</span>
        {% endif %}
      </td>
      <td>{{ guess.timestamp|timesince }} ago</td>
    </tr>
  {% empty %}
    <tr><td><em>You have made no submissions yet.</em></td></tr>
  {% endfor %}
</table>

</div></body></html>  <!-- end .pagecontent -->
